//
//  WMTabBarController.swift
//  SwiftTestProjectDemo
//
//  Created by 李煜 on 2024/4/21.
//

import UIKit

class WMTabBarController: UITabBarController {
    override func viewDidLoad() {
        super.viewDidLoad()

        setupChildVC()
    }

    func setupChildVC() {
        let home = HomeController()
        home.tabBarItem.title = "首页"
		home.tabBarItem.image = UIImage(systemName: "house")?.withRenderingMode(.alwaysOriginal)
		home.tabBarItem.selectedImage = UIImage(systemName: "house.fill")?.withRenderingMode(.alwaysOriginal)
		
        home.tabBarItem.setTitleTextAttributes([.foregroundColor: UIColor.lightGray], for: .normal)
        home.tabBarItem.setTitleTextAttributes([.foregroundColor: UIColor.red], for: .selected)
        let homeNav = UINavigationController(rootViewController: home)

        let categoryVC = CategoryController()
        categoryVC.tabBarItem.image = UIImage(systemName: "tray")?.withRenderingMode(.alwaysOriginal)
        categoryVC.tabBarItem.selectedImage = UIImage(systemName: "tray.fill")?.withRenderingMode(.alwaysOriginal)
        categoryVC.tabBarItem.title = "分类"
        categoryVC.tabBarItem.setTitleTextAttributes([.foregroundColor: UIColor.lightGray], for: .normal)
        categoryVC.tabBarItem.setTitleTextAttributes([.foregroundColor: UIColor.red], for: .selected)
        let categoryNav = UINavigationController(rootViewController: categoryVC)

        viewControllers = [homeNav,categoryNav]
    }
}
